]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
systemActions: Don't log error when cancelled
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Oct 2025 22:57:26 +0000 (00:57 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 24 Oct 2025 15:37:15 +0000 (15:37 +0000)
If the logout/reboot/shutdown actions are available, we expect them
to succeed. Unfortunately that changed in the light of systemd
inhibitors (that we don't know about in the shell, and that prevent
those actions now).

While it would be good to fix the underlying issue, we can at least
improve the error reporting in that case and not log the error when
the operation was cancelled: We don't know the underlying reason,
unlike gnome-session which should have logged a more helpful message.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8749
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3927>

js/misc/systemActions.js

index ae0268903cc05d5e42519f32e448ddc75acd56f3..710d42fa547aa08163a092d697cbfd7a2992dc07 100644 (file)
@@ -5,6 +5,7 @@ import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
 
+import {logErrorUnlessCancelled} from './errorUtils.js';
 import * as GnomeSession from './gnomeSession.js';
 import * as LoginManager from './loginManager.js';
 import * as Main from '../ui/main.js';
@@ -448,21 +449,21 @@ const SystemActions = GObject.registerClass({
             throw new Error('The logout action is not available!');
 
         Main.overview.hide();
-        this._session.LogoutAsync(0).catch(logError);
+        this._session.LogoutAsync(0).catch(logErrorUnlessCancelled);
     }
 
     activatePowerOff() {
         if (!this._actions.get(POWER_OFF_ACTION_ID).available)
             throw new Error('The power-off action is not available!');
 
-        this._session.ShutdownAsync(0).catch(logError);
+        this._session.ShutdownAsync(0).catch(logErrorUnlessCancelled);
     }
 
     activateRestart() {
         if (!this._actions.get(RESTART_ACTION_ID).available)
             throw new Error('The restart action is not available!');
 
-        this._session.RebootAsync().catch(logError);
+        this._session.RebootAsync().catch(logErrorUnlessCancelled);
     }
 
     activateSuspend() {